﻿# 采用C#语言定义的类型
$source = @"
    public class BasicTest
    {
        public static int Add(int a, int b)
        {
            return (a + b);
        }
   
        public int Multiply(int a, int b)
        {
            return (a * b);
        }
    }
"@

# 将类型加载到系统中
Add-Type -TypeDefinition $source

# 调用
[int]$add_result = [BasicTest]::Add(4,3)
echo $add_result

# 新建对象调用
$inst = New-Object BasicTest
echo $inst.Multiply(5,5)


